home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1997 May / PC Plus Super CD Issue 127 (May 1997).iso / fixes / delp126 / jackpot / jack1.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-01-19  |  1.0 KB  |  53 lines

  1. unit Jack1;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Edit1: TEdit;
  12.     Button1: TButton;
  13.     procedure Button1Click(Sender: TObject);
  14.   private
  15.     { Private declarations }
  16.   public
  17.     { Public declarations }
  18.   end;
  19.  
  20. var
  21.   Form1: TForm1;
  22.  
  23. implementation
  24.  
  25. {$R *.DFM}
  26.  
  27. procedure TForm1.Button1Click(Sender: TObject);
  28. var         { declare 2 integger variables }
  29.   oldnum,
  30.   newnum : integer;
  31.             { begin code section           }
  32. begin
  33.     { initialise oldnum to integer shown in the caption of this form  }
  34.   oldnum := StrToInt( Caption );
  35.   newnum := oldnum + 1;
  36.     { on 10th click of the button, Jackpot!                           }
  37.   if newnum = 10 then
  38.   begin
  39.     Edit1.Text := 'Jackpot!';
  40.     Color   := clRed;
  41.     Caption := IntToStr( 0 );
  42.   end
  43.     { all other clicks, you lose }
  44.   else
  45.   begin
  46.     Caption := IntToStr( newnum );
  47.     Edit1.Text := '';
  48.     Color := clBtnFace;
  49.   end;
  50. end;
  51.  
  52. end.
  53.